<script setup>
  import AppHeader from './components/AppHeader.vue'
  import {routeDispatch} from './http/utils.js'

  import userStore from './store/user.js'
  // 获取localstorage中的user信息，并将信息保存到user store中
  let userInfo = window.localStorage.getItem('wg_user')
  if(userInfo) {
    userInfo = JSON.parse(userInfo)
    const uStore = userStore()
    uStore.updateUser(userInfo)
  }else{
    routeDispatch("/login")
  }
</script>

<template>
  <el-affix :offset="0">
    <AppHeader v-if="$route.meta.headeAalive"/>
  </el-affix>
  <router-view/>
</template>

<style scoped>

</style>
